import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'common/style/common.less'
import common from 'common/index' // 全局注册组件
import * as flters from '@/filters' // 全局注册filters
// import { get, remove, post, put } from 'util/request' // 封装请求方法
// import api from 'api/index' // 抽取全部api
import Router from 'vue-router'

// 解决路由重复点击console台报错bug
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.config.productionTip = false

Vue.use(Element)
Vue.use(common)

// 注入 全局 filters
Object.keys(flters).forEach(key => {
  Vue.filter(key, flters[key])
})
// 原型注入方法
// Vue.prototype.$$post = post
// Vue.prototype.$$get = get
// Vue.prototype.$$remove = remove
// Vue.prototype.$$put = put
// Vue.prototype.$$api = api

/* eslint-disable */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
